package com.example.ratting_bar

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.RatingBar
import android.widget.Toast

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val ratingBar = findViewById<RatingBar>(R.id.rating_bar)

        ratingBar.setOnRatingBarChangeListener{ rb: RatingBar, fl: Float, b: Boolean ->
            Toast.makeText(this@MainActivity,"星级:" + rb.rating, Toast.LENGTH_SHORT).show()
        }

    }
}
